﻿function DialogBtnQuery_OnClick()
{  
    try
    {
    
        if ($("#txtVENDOR_NO").val() == "")
		{
            $("#lblVENDOR_NO_ERR").text(GetMessageByID("MSG031").text);
		}
		else
		{
            $("#lblVENDOR_NO_ERR").text("");
			
		}
        if ($("#txtE_MAIL").val() == "")
		{
		    $("#lblE_MAIL_ERR").text(GetMessageByID("MSG032").text);
		}
		else
		{
		    $("#lblE_MAIL_ERR").text("");
		    if(!$("#txtE_MAIL").val().match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/))
			{
		        $("#lblE_MAIL_ERR").text(GetMessageByID("MSG025").text);
			}
		}
        if ($("#lblVENDOR_NO_ERR").text() == "" && $("#lblE_MAIL_ERR").text() == "")
		{
			return true;
		}
		else
		{
			alert(GetMessageByID("MSG020").text);
			return false;
		}
		
    }
	catch (e)
	{
        alert(e.Message);
        return false;
	}
	finally
	{
	
	}
}


function chkMAIL(o,o1)
{

	 var chk = true;
	 o1 = $(o1);
		if (o.value != "")  
		{
			if(!o.value.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/))
			{
				o1.text(GetMessageByID("MSG025").text);
				
				chk=false;
		    }
		    else
		    {
				o1.text("");
				chk = true;
		    }
		    
	   
		}   
		
		return chk;
}


function Query_VENDOR_NO(o)
{
	try
		{
			var XmlDocu = null;
			addFormNode("VNDW0012","Query_VENDOR_NO");
       		addCommandNode("V_VND_VENDOR","sel");
			addParameterNode("VENDOR_NO","string",o.value.toUpperCase());
			xmlstr = getXML();
			XmlDocu = ExecuteQuery(xmlstr);
			var htmlDataSet = new dataSetObject();
			htmlDataSet.load(XmlDocu);
			if(htmlDataSet != undefined)
			{
				var Result = htmlDataSet.getTable("info").rows[0].getAttribute("ReturnCode");
				if (Result == "000")
				{
				
				}
				else
				{
				    $("#lblVENDOR_NO_ERR").text(GetMessageByID("MSG039").text);
				}
			}
		}
	catch(e)
		{
			alert(e.Message);
		}

}


